package com.ruoyi.yljf.controller.AppController;


import cn.hutool.core.bean.BeanUtil;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.security.annotation.Anonymous;
import com.ruoyi.yljf.domain.Report;
import com.ruoyi.yljf.domain.dto.ReportDTO;
import com.ruoyi.yljf.service.IReportService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 举报记录
 */
@RestController
@Anonymous
@RequestMapping("/api/report")
public class ApiReportController extends BaseController {
    @Resource
    private IReportService reportService;

    /**
     * 举报列表
     */
    @GetMapping(value = "/list")
    public AjaxResult getReportList(ReportDTO reportDTO) {
        Report report = BeanUtil.copyProperties(reportDTO,Report.class);
        return success(reportService.selectReportList(report));
    }

    /**
     * 举报评论
     */
    @PostMapping(value = "/addReprot")
    public AjaxResult addReprot(ReportDTO reportDTO) {
        return success(reportService.addReprot(reportDTO));
    }
}
